package com.example.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@Configuration
@ComponentScan("com.example") // 扫描 com.example 包下的所有组件（包括 TaskService）
public class ThreadPoolConfig {

    @Bean // 声明线程池为 Spring Bean
    public ExecutorService threadPool() {
        return Executors.newFixedThreadPool(5); // 示例：创建固定大小为 5 的线程池
    }
}